import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './utils/vant'

Vue.config.productionTip = false
router.beforeEach((to,from,next)=>{
  // console.log(to,from)
  // next()
  // /user 需要处在登录态
  if(to.path == '/user' && !store.state.userInfo.phone){
    next('/login')
  }else{
    next()
  }
})

Vue.filter('money',function(val=0){
  return '$'+(val.toFixed(2))
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
